package org.wukongcrm.controller;

import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import org.wukongcrm.domain.entity.CustomerFollowup;
import org.wukongcrm.domain.model.CustomerFollowupVo;
import org.wukongcrm.domain.model.R;
import org.wukongcrm.service.CustomerFollowupService;

import java.util.Date;
import java.util.List;

/**
 * @author ZhongWang
 * @since 2025 03 30:18:23
 */
@RestController
@AllArgsConstructor
@RequestMapping("/followup")
public class FollowupController {

    private final CustomerFollowupService customerFollowupService;

    @PostMapping
    public R createFollowup(@RequestBody CustomerFollowup customerFollowup) {
        customerFollowup.setCreateTime(new Date());
        customerFollowup.setCreateUserId(1);
        customerFollowupService.save(customerFollowup);
        return R.success(200);
    }

    @GetMapping
    public R<List<CustomerFollowupVo>> getFollowupList(Integer followupOptionId) {
        List<CustomerFollowupVo> customerFollowupVos = customerFollowupService.selectFollowup(followupOptionId);
        return R.success(200, "success", customerFollowupVos);
    }

}
